package com.heima.media.controller;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.heima.common.dto.PageRequestDto;
import com.heima.common.dto.ResponseResult;
import com.heima.media.entity.WmSensitive;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.heima.media.service.IWmSensitiveService;

import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 敏感词信息表 前端控制器
 * </p>
 *
 * @author GQ
 * @since 2023-07-09
 */
@RestController
@RequestMapping("/api/v1/sensitive")
@Api(tags = "敏感词信息表接口")
@CrossOrigin
public class WmSensitiveController {

    @Autowired
    private IWmSensitiveService wmSensitiveService;

    /**
     * 敏感词列表
     * @param dto
     * @return
     */
    @PostMapping("list")
    public ResponseResult<List> listByPage (PageRequestDto dto){
        return wmSensitiveService.ListByPage(dto);
    }

    /**
     * 新增敏感词
     * @param wmSensitive
     * @return
     */
    @PostMapping
    public ResponseResult saveSensitive(@RequestBody WmSensitive wmSensitive){
        return wmSensitiveService.saveSensitive(wmSensitive);
    }

    /**
     * 删除敏感词
     * @param id
     * @return
     */
    @DeleteMapping("/{id}")
    public ResponseResult deleteSensitive(@PathVariable("id") Integer id){
        return wmSensitiveService.deleteSensitive(id);
    }

    /**
     * 修改敏感词
     * @param wmSensitive
     * @return
     */
    @PutMapping
    public ResponseResult updateSensitive(@RequestBody WmSensitive wmSensitive){

        return wmSensitiveService.updateSensitive(wmSensitive);
    }
}
